package com.example.optionmenudemo;

import android.app.Activity;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.widget.Toast;

public class MainActivity extends Activity {

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_main);
	}

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		// Inflate the menu; this adds items to the action bar if it is present.

		getMenuInflater().inflate(R.menu.main, menu);

		return true;
	}

	@Override
	public boolean onOptionsItemSelected(MenuItem item) {
		// TODO Auto-generated method stub
		switch (item.getItemId()) {
		case R.id.setting:
			Toast.makeText(MainActivity.this, "Setting", Toast.LENGTH_LONG)
					.show();
		case R.id.help:
			Toast.makeText(MainActivity.this, "Help", Toast.LENGTH_LONG).show();
		case R.id.map:
			Toast.makeText(MainActivity.this, "Map", Toast.LENGTH_LONG).show();
		case R.id.mail:
			Toast.makeText(MainActivity.this, "Mail", Toast.LENGTH_LONG).show();
		case R.id.edit:
			Toast.makeText(MainActivity.this, "Edit", Toast.LENGTH_LONG).show();
			{
				switch (item.getItemId()) {
				case R.id.setting1:
					Toast.makeText(this, "Setting1", Toast.LENGTH_LONG).show();
					break;
				case R.id.help1:
					Toast.makeText(this, "Help1", Toast.LENGTH_LONG).show();
				}
			}
		case R.id.more:
			Toast.makeText(MainActivity.this, "Setting", Toast.LENGTH_LONG).show();
			{
				switch (item.getItemId()) {
				case R.id.mot:
					Toast.makeText(this, "Mot", Toast.LENGTH_LONG).show();
					
					break;

				case R.id.hai:
					Toast.makeText(this, "Hai", Toast.LENGTH_LONG).show();
					break;
				}
			}
			break;

		default:
			break;
		}
		return super.onOptionsItemSelected(item);
	}
}
